;;; packages - package definitions for GNU Guix
;;; Copyright (C) 2016, 2017 ng0
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU Affero General Public License as
;;; published by the Free Software Foundation, either version 3 of the
;;; License, or (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU Affero General Public License for more details.
;;;
;;; You should have received a copy of the GNU Affero General Public License
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

(define-module (ng0 packages zsh)
  #:use-module (guix packages)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages)
  #:use-module (gnu packages shells)
  #:use-module (gnu packages perl))

(define-public zsh-syntax-highlighting
  (package
    (name "zsh-syntax-highlighting")
    (version "0.5.0")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://github.com/zsh-users/"
                                  "zsh-syntax-highlighting/archive/"
                                  version ".tar.gz"))
              (sha256
               (base32
                "1gh8jsq7dxpi7hh1pil50ncjrgdvy0r9mnb94zdqsmrqx10g39z2"))
              (file-name (string-append name "-" version ".tar.gz"))))
    (build-system gnu-build-system)
    (arguments
     `(#:tests? #f ; Currently fails.
       #:phases
       (modify-phases %standard-phases
         (delete 'configure) ; No configure phase
         (add-before 'install 'setenv
           (lambda* (#:key outputs #:allow-other-keys)
             (setenv "PREFIX" (assoc-ref outputs "out")))))))
         ;; (replace 'check
         ;;   (lambda _
         ;;     (and
         ;;      (zero? (system* "make" "test"))
         ;;      (zero? (system* "make" "perf"))))))))
    (inputs
     `(("zsh" ,zsh)))
    (native-inputs
     `(("perl" ,perl)))
    (synopsis "Fish shell like syntax highlighting for zsh")
    (description
     "This package provides syntax highlighing for the shell zsh.  It
enables highlighing of commands whilst they are typed at a zsh prompt into
an interactive terminal.  This helps in reviewing commands before running
them, particularly in catching syntax errors.")
    (home-page "https://github.com/zsh-users/zsh-syntax-highlighting")
    (license license:bsd-3)))
